﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using BioBooking.Data;
using System.Windows.Media;
using System.Windows.Controls;

namespace BioBooking.Client.ValueConverters
{
    [ValueConversion(typeof(bool), typeof(SolidColorBrush))]
    public class BooleanToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SolidColorBrush brush = new SolidColorBrush();

            bool condition = (bool)value;

            if (condition)
            {
                brush.Color = Colors.Red;
            }
            else //must be free
            {
                brush.Color = Colors.Green;
            }

            return brush;
        }

        public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            return false;
            ////Not needed
            //throw new NotImplementedException();
        }
    }
}
